package GUI;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Map;

public class MenuPanel extends JPanel implements ActionListener {
    private ImageIcon imageIcon = Util.getIcon("/img/buttonOff.jpg");
    private ImageIcon imageIcon1 = Util.getIcon("/img/buttonSave.jpg");
    private ImageIcon imageIcon2 = Util.getIcon("/img/buttonGet.jpg");
    private ImageIcon imageIcon3 = Util.getIcon("/img/buttonFind.jpg");
    private JButton loginjButton;
    private JButton loginjButton1;
    private JButton loginjButton2;
    private JButton loginjButton3;
    private Text2 frame;

    public MenuPanel(Text2 frame) {
        this.frame = frame;
        this.setLayout(null);
        this.setOpaque(false);


        loginjButton1 = new JButton(imageIcon1);
        loginjButton1.setBounds(0, 150, 100, 50);
        this.add(loginjButton1);


        loginjButton2 = new JButton(imageIcon2);
        loginjButton2.setBounds(0, 250, 100, 50);
        this.add(loginjButton2);

        loginjButton3 = new JButton(imageIcon3);
        loginjButton3.setBounds(690, 150, 100, 50);
        this.add(loginjButton3);

        loginjButton = new JButton(imageIcon);
        loginjButton.setBounds(690, 250, 100, 50);
        this.add(loginjButton);
        loginjButton.addActionListener(this);

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == loginjButton) {
            frame.switchPanel("login");
        }else if(e.getSource() == loginjButton1||e.getSource() == loginjButton2||e.getSource() == loginjButton3){
            frame.switchPanel("turn");
        }
    }
}
